package vip.source.components;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import vip.source.config.OssProperties;
import vip.source.service.OssService;

/**
 * @author zy
 */
public class OssTemplate {
    @Autowired
    private OssProperties ossProperties;
    @Autowired
    private ApplicationContext context;

    public Boolean send(String fromPhone, String toPhone, String content) {
        //获取云厂商的业务实现类
        String type = ossProperties.getType();
        OssService ossService = (OssService) context.getBean(type);
        return ossService.send(fromPhone, toPhone, content);
    }
}
